package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.User;
import com.cskaoyan.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("user")
@RestController
public class UserController {
    @RequestMapping("hello")
    public BaseRespVo hello(){
        return BaseRespVo.ok("hello everyone");
    }

    @Autowired
    UserService userService;

    @RequestMapping("list")
    public BaseRespVo list() {
        List<User> users = userService.queryUsers();
        return BaseRespVo.ok(users);
    }
}
